package com.peter.netty.io.bio.tomcat.http;

/**
 * @Auther: 肖冬
 * @Date: 2020/9/14 20:39
 * @Description: 只用到了模板方法模式
 */
public abstract class XDServlet {

    public void service(XDRequest request,XDResponse response) throws Exception{
        if("GET".equalsIgnoreCase(request.getMethod())){
            doGet(request,response);
        }else{
            doPost(request,response);
        }
    }

    protected abstract void doPost(XDRequest request, XDResponse response) throws Exception;

    protected abstract void doGet(XDRequest request, XDResponse response) throws Exception;

}
